<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>

	<body>
		<script type="text/javascript">
			// var a = "<p style=''><span><sub>5</sub></span><span><sup>5</sup></span></p>";
			var a = "<p class='MsoNormal' style='text-indent:21.0000pt;mso-char-indent-count:0.0000;'><span style=''>10<sup><span style='cs '>5</sup><span style=''><o:p></o:p>";
			rex = [/style\s*?=\s*?(['|"])[\s\S]*?\1/, /<sup>/g, /<\/sup>/g, /<sub>/g, /<\/sub>/g, /<\/?[a-z]*>/g, /\|SUP/g, /\|SUB/g];
			var replacement = ["", "<sup|SUP>", "<\/sup|SUP>", "<sub|SUB>", "<\/sub|SUB>", "", "", ""];
			for(var i = 0; i < rex.length; i++) {
				a = a.replace(rex[i], replacement[i]);
			}
			console.log(a);
		</script>
	</body>
	<html>